<%@page import="com.myapp.actions.user.GetUser"%>
<%@page import="com.myapp.entity.Role"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="mwt" tagdir="/WEB-INF/tags/" %>
<%@taglib prefix="mw" uri="/WEB-INF/tlds/myweb" %>
<mw:action action="<%=new GetUser()%>" result="result"/>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
  <head>
    <title>CliniQ</title>
    <%@include file="/commons/head.jsp" %>
  </head>
  <body>
    <%@include file="/commons/navbar.jsp" %>
    <div class="container">
      <form id="user-detail" class="form-horizontal">
        <input type="hidden" id="id" name="id" value="${result.id}" />
        <div class="control-group">
          <label class="control-label" for="username">Username</label>
          <div class="controls">
            <input type="text" readonly="readonly" value="${result.username}" id="username" placeholder="Username">
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="password">Password</label>
          <div class="controls">
            <input type="text" readonly="readonly" value="${result.password}" id="password" placeholder="Password">
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="timeZone">Time Zone</label>
          <div class="controls">
            <select name="timeZone" id="timeZone">
              <c:forEach var="tz" items="${timezones}">
                <c:choose>
                  <c:when test="${tz.ID == result.timeZone}">
                    <option selected="selected" value="${tz.ID}">${tz.ID}</option>
                  </c:when>
                  <c:otherwise>
                    <option value="${tz.ID}">${tz.ID}</option>
                  </c:otherwise>
                </c:choose>
              </c:forEach>
            </select>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="role">Role</label>
          <div class="controls">
            <c:set var="roles" value="<%=Role.values()%>"/>
            <c:forEach var="role" items="${roles}">
              <label class="checkbox inline">
                <c:set var="checked" value="" />
                <c:if test="${result.inRole(role)}">
                  <c:set var="checked" value="checked='checked'" />
                </c:if>
                <input type="checkbox" ${checked} name="role" id="role" value="${role.toString()}"> ${role.toString()}
              </label>
            </c:forEach>
          </div>
        </div>
        <div class="control-group">
          <div class="controls">
            <input type="submit" class="btn" value="Update" />
            <input type="button" class="btn" id="user-delete-btn" value="Delete" />
          </div>
        </div>
      </form>
    </div>
    <%@include file="/commons/footer.jsp" %>
  </body>
</html>

